//
//  HTHolderGoodsCell.m
//  TruckDriver
//
//  Created by Ting Han on 2017/10/23.
//  Copyright © 2017年 Ting Han. All rights reserved.
//

#import "HTHolderGoodsCell.h"

@interface HTHolderGoodsCell()
@property (weak, nonatomic) IBOutlet UILabel *startLabel;
@property (weak, nonatomic) IBOutlet UILabel *destiLabel;
@property (weak, nonatomic) IBOutlet UIView *tapCallNumber;
@property (weak, nonatomic) IBOutlet UILabel *truckTypeLabel;
@property (weak, nonatomic) IBOutlet UILabel *scanNumberLabel;
@property (weak, nonatomic) IBOutlet UILabel *callNumber;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;

@end

@implementation HTHolderGoodsCell


- (void)setHolderListModel:(HTHolderListModel *)holderListModel{
    _holderListModel = holderListModel;
    DBLog(@" holderListModel.fromadd:%@", holderListModel.fromadd);
    self.startLabel.text = holderListModel.fromadd;
    self.destiLabel.text = holderListModel.toadd;
    
    NSString *length = [HTUtils sortLengthDisplayStringWith:holderListModel.heiht];
    NSString *dun = @"";
    if ([holderListModel.utit isEqualToString:@"1"]) {
        dun =[NSString stringWithFormat:@"%@吨",holderListModel.weight];
    }else{
        dun =[NSString stringWithFormat:@"%@方",holderListModel.weight];
    }
    
    NSString *cartype = (holderListModel.cartype == nil || holderListModel.cartype.length <= 0)?@" ":[NSString stringWithFormat:@"%@ ",holderListModel.cartype];
    NSString * goodtype = (holderListModel.goodtype == nil || holderListModel.goodtype.length <= 0)?@"不限车型":[NSString stringWithFormat:@"%@ ",holderListModel.goodtype];
    self.truckTypeLabel.text = [NSString stringWithFormat:@"%@ %@/ %@ %@",length,goodtype,cartype,dun];
    self.scanNumberLabel.text = [NSString stringWithFormat:@"浏览数 %@",holderListModel.number];
    self.callNumber.text = [NSString stringWithFormat:@"拨打数 %@",holderListModel.callnum];
    self.timeLabel.text = [HTUtils timeIntervalExchange:holderListModel.createtime];

}
- (void)awakeFromNib {
    [super awakeFromNib];
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapCallNumber:)];
    [self.tapCallNumber addGestureRecognizer:tap];
}
- (void)tapCallNumber:(id)tap{
    
    NSString *phone = self.holderListModel.phone;
    NSString *str=[[NSMutableString alloc] initWithFormat:@"tel:%@",phone];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
    [HTUtils netLoadCallRecordWithOrderid:self.holderListModel.orderid];
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    
    [super setSelected:selected animated:animated];
    
}

@end
